#include "pch.h"
#include "projectViewDemo.h"
#include "Scene.h"
#include "RendererEngine.h"
#include "renderer.h"

CProjectViewDemo::CProjectViewDemo()
{

}

CProjectViewDemo::~CProjectViewDemo()
{
	SafeDelete(mpProjectView);
}

void CProjectViewDemo::init(mini::CEngine* pEngine)
{
	mpProjectView = new mini::CProjectView;
	mpProjectView->setViewPoint(mini::CPoint3F(2.0f, 5.0f, -2.0f));
	mpProjectView->setLookAt(mini::CPoint3F(.0f, 0.0f, 0.0f));
	mpProjectView->setProjectionParameters((float)(D3DX_PI / 2.0f), 1.0f, 0.1f, 100.0f);
	mpProjectView->bindMaterial(R"(resource\Material\projectView.ma)");
	mpProjectView->setProjectTexture(R"(resource\Texture\grate.dds)", 1);
	auto pRenderer = mini::CRendererEngine::getSinglePtr()->findRenderer(mini::RendererType::FrontRenderer);
	if (nullptr != pRenderer)
	{
		pRenderer->addEffect(mpProjectView, 0);
	}
}
